﻿@using NTQOnlineExamFrontend.Resources

@if (Request.IsAuthenticated)
{
    using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new {id = "logoutForm"}))
    {
        @Html.AntiForgeryToken()
        <button class="navbar-btn btn btn-red pull-right hidden-sm hidden-xs" onclick=" javascript:document.getElementById('logoutForm').submit() ">Sign Out</button>
    }
}
else
{
    <a class="navbar-btn btn btn-red pull-right hidden-sm hidden-xs" href="@Url.RouteUrl(new { Controller = "Account", Action = "Login"})">Sign In</a>
}
<ul class="nav navbar-nav navbar-right" id="topMenu">
     <li class="hidden-sm" id="top-home">
         <a href="#" class="dropdown-toggle" data-toggle="dropdown"> @Menu.Home <b class="caret"></b></a>
        <ul class="dropdown-menu">
            <li><a href='@Url.RouteUrl(new { Controller = "Content", Action = "HomePage" })'>@Menu.Home </a></li>
            <li><a href='@Url.RouteUrl(new { Controller = "Content", Action = "AboutUs" })'>@Menu.AboutUs </a></li>
            <li><a href='@Url.RouteUrl(new { Controller = "Content", Action = "FeeAndTrialExams" })'>@Menu.Fees </a></li>
            <li><a href='@Url.RouteUrl(new { Controller = "Content", Action = "FAQ" })'>@Menu.FAQ </a></li>
            <li><a href='@Url.RouteUrl(new { Controller = "Content", Action = "ContactUs" })'>Contact Us</a></li>
        </ul>        
    </li>
    <li class="dropdown" id="top-menu-examination">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown">@Menu.Examination <b class="caret"></b></a>
        <ul class="dropdown-menu">
            <li><a href="/Member/Examination">@Menu.DoAnExam</a></li>
            <li><a href="/Portfolio/UserPortfolio">@Menu.Portfolio</a></li>
            <li><a href="/Member/ExaminationHistory">@Menu.History</a></li>
        </ul>
    </li>
    <li class="active hidden-sm" id="top-menu-term">
        <a href='@Url.RouteUrl(new { Controller = "Term", Action = "GetTerms" })'>Shop </a>
    </li>
    <li class="dropdown" id="top-menu-personal">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Personal <b class="caret"></b></a>
        <ul class="dropdown-menu">
            <li><a href="/Order/OrderHistory">Order History</a></li>
            <li><a href="/Account/Profile">Profile</a></li>
            <li><a href="/Account/Manage">Change Password</a></li>
        </ul>
    </li>
      @if (Request.IsAuthenticated)
    {
        
        <li data-animate="animated fadeInUp" class="hidden-sm animate-hover" id="top-menu-basket">
            <a title="View your shopping cart" href="@Url.RouteUrl(new { Controller = "Basket", Action = "GetUserBasket" })"><i class="fa fa-shopping-cart"></i><span id="basket-qty" class="amount">0</span></a>
        </li>
        <li class="hiTopMenu"> Hi @User.Identity.Name , </li>
    }
</ul>
<div id="topShoppingCart" class="topShoppingCart"></div>
@{
    var controller = HttpContext.Current.Request.RequestContext.RouteData.Values["controller"].ToString();
}
<script type="text/javascript">
    $(document).ready(function () {
        SetActiveTopMenu();
        var isAuthenticated = '@Request.IsAuthenticated';
        if (isAuthenticated.toLowerCase() == 'false') return;
        BasketClient.RefreshTopBasket(false);
        $("#top-menu-basket").hover(function () {
            $("#topShoppingCart").stop().fadeIn();
        }, function () {
            $("#topShoppingCart").stop().fadeOut(200);
        });
    });

    function SetActiveTopMenu() {
        $("#topMenu li").removeClass("active");
        var controller = '@controller';
        switch (controller.toLowerCase()) {
            case 'member':
                $("#top-menu-examination").addClass("active");
                break;
            case 'order':
            case 'porfolio':
            case 'account':
                $("#top-menu-personal").addClass("active");
                break;
            case 'basket':
                $("#top-menu-basket").addClass("active");
                break;
            case 'term':
                $("#top-menu-term").addClass("active");
                break;
            case 'content':
                $("#top-home").addClass("active");
                break;
        }
    }


</script>
